***Age at first child***
clear
use "Data\Core_datasets\main_careers_kids.dta" 

keep pnr aar kids birthday_kid* koen

gen dum=0
replace dum=1 if kids==1

sort pnr aar
by pnr: egen dum2=min(aar) if dum==1
by pnr: egen first_kid_year=min(dum2)

drop dum dum2

save "Data\first_child.dta", replace